package com.easy.auth.controller;

import com.easy.common.service.IAdminService;
import com.easy.common.service.IUserService;
import com.easy.common.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    IUserService userService;
    @Autowired
    IAdminService adminService;

    @PostMapping("/admin/dologin")
    public Result adminlogin(String username, String password){
       String token = adminService.login(username,password);
       return Result.success(token);
    }

    @PostMapping("/user/dologin")
    public Result userlogin(String username, String password){
       String token = userService.login(username,password);
       return Result.success(token);
    }

}
